#include <REGX52.H>
#include "Delay.h"

//检测独立按键按下
//返回按下的是第几个按钮(无按键按下时返回0)
unsigned char SHUCHU;
unsigned char Key(void)
{
	if(P3_1==0)
	{
		return 1;
	}
	if(P3_0==0)
	{
		return 2;
	}
	if(P3_2==0)
	{
		return 3;
	}
	if(P3_3==0)
	{
		return 4;
	}
	return 0;
}
	
unsigned char Key_FanHui(void)
{
	unsigned char Lingshi=0;
	Lingshi=SHUCHU;
	SHUCHU=0;
	return Lingshi;
}



void Key_DingShiQi(void)
{
	static unsigned char XIAN=0;
	static unsigned char YUAN=0;
	YUAN=XIAN;
	XIAN=Key();
	if(YUAN!=0&&XIAN==0)
	{
		SHUCHU=YUAN;
	}
	
}
